
var routingModule = angular.module('routing', ['Security'])
.run( function($Security, $scope, $location) {
    $scope.$on( "$locationChangeStart", function(event, next) {
      if ( $Security.getCurrentUser == null ) {
        if ( next.templateUrl == "templates/login.html" ) {
        	alert('Viene el login');
        } else {
        	// not going to #login, we should redirect now
	        $location.path( "/login" );
	        alert ('Debo ir a login');          
        }
      }         
    });
 });